package cn.gok.object;

class A{
    int x=0;
    public A(int x){
        this.x=x;
    }
}


public class 深拷贝和浅拷贝 {
    public static void main(String[] args) {
       //浅拷贝
        A a1 =new A(0);
        A a2=a1;
        a1.x=100;
        System.out.println(a2.x);
        //深拷贝
        A a3=new A(a1.x);
        a1.x=200;
        System.out.println(a3.x);


    }
}
